home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8984 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: newsbf02.news.aol.com!not-for-mail
  2. From: kasslar@aol.com (Kasslar)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Order of initialisation of static globals
  5. Date: 27 Feb 1996 14:22:38 -0500
  6. Organization: America Online, Inc. (1-800-827-6364)
  7. Sender: root@newsbf02.news.aol.com
  8. Message-ID: <4gvllu$ru@newsbf02.news.aol.com>
  9. References: <DMtrnr.Mo8.0.-s@cs.vu.nl>
  10. Reply-To: kasslar@aol.com (Kasslar)
  11. NNTP-Posting-Host: newsbf02.mail.aol.com
  12.  
  13. This is a well known problem and is fully explained in "The Annotated C++
  14. Reference Manual", Ellis, April 1995, Addison Wesley Publishing - Page 19
  15. last paragraph. Look at the source code for the iostream library, cin &
  16. cout are handled just this way. I choose to live by the statement, "it is
  17. usually wise to avoid dependencys on dynamic initialization order".
  18.  
  19. If you still don't have the manual handy note that each "translation unit"
  20. is initialized before its first use which is not always posible. A
  21. tolerable solution is to put the statics in the same code module so that
  22. you can order them appropriatly.
  23.  
  24. Regards,
  25. Randy Abernethy
  26. ----------------------------------------
  27. Randy Abernethy
  28. Kasslar Enterprises
  29. kasslar@aol.com
  30. randya@spectralinc.com
  31. rabernethy@spectralinc.com
  32. ----------------------------------------
  33.